﻿using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InfrastructureBase.Base.AuthBase.CustomAuth.Authorization
{
    public static class CustomAuthentizationExtensions
    {
        /// <summary>
        /// 添加自定义授权方式
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static IServiceCollection AddCustomAuthentizationService(this IServiceCollection services)
        {
            services.AddSingleton<IAuthorizationHandler, CustomAuthorizationHandler>();

            services.AddSingleton<IAuthorizationPolicyProvider, AuthorizationPolicyProvider>();
            return services;
        }
    }
}
